
<?php
$form = $this->beginWidget('GxActiveForm', array(
    'id' => 'contactus-form',
    'enableClientValidation' => true,
    'clientOptions' => array(
        'validateOnSubmit' => true,
        'validateOnChange' => true,
        'enableAjaxValidation' => true,
    ),
    'htmlOptions' => array(
        'class' => 'form',
    ),
        ));
?>

<div class="form-group">
    <h4>CONTACT US</h4>
    <?php echo $form->textField($model, 'name', array('maxlength' => 45, 'class' => 'form-control inputtxt', 'placeholder' => 'Name*')); ?>
    <?php echo $form->error($model, 'name'); ?>   

    <?php echo $form->textField($model, 'email', array('class' => 'form-control inputtxt', 'placeholder' => 'Email*')); ?>
    <?php echo $form->error($model, 'email'); ?> 
    <?php echo $form->textField($model, 'subject', array('class' => 'form-control inputtxt', 'placeholder' => 'Subject*')); ?>
    <?php echo $form->error($model, 'subject'); ?> 

    <?php echo $form->textArea($model, 'message', array('class' => 'form-control txtarea', 'placeholder' => 'Message...')); ?>
    <?php echo $form->error($model, 'message'); ?>
    <div id="contactusloder" style="display: none"><img src="<?php echo ThemePath(); ?>/images/myskill.gif"></img></div> 
    <p class="alignR remmarginB">
        <?php
        echo CHtml::ajaxSubmitButton('Submit', CHtml::normalizeUrl(array('site/contact')), array(
            'dataType' => 'json',
            'type' => 'post',
            'success' => 'function(data) {
                        $("#contactusloder").hide();  
						 if(data.status=="success"){
                        $("#contactusResult").show();
                        $("#contactusResult").html("Thank you for contacting us. We will respond to you as soon as possible.");
						$(".alignR").html("&nbsp;");
                                                 $("#contactus-form")[0].reset();
                        } else{
                         $.each(data, function(key, val) {   
                        $("#"+key+"_em_").text(val);                                                    
                        $("#"+key+"_em_").show();
                        });
                        }
                    }',
            'beforeSend' => 'function(){                        
                           $("#contactusloder").show();
                      }'
                ), array('class' => 'pull-right',));
        ?>
    </p>
    <p id="contactusResult" style="font-size: 13px;color: #000;display: none;"></p>

</div>


<?php
$this->endWidget();
?>
